var app = getApp(),
  $ = require("../../utils/httpHelper.js")
Page({
  data: {
    shoplist:[],
    shopname:''
  },
  onShareAppMessage: function (res) {
    app.shareApp(res)
  },
  onLoad: function (option) {
    var that = this;
    var rd_session = wx.getStorageSync('rd_session');
    if (!app.check_empty(option.shopname)) {
      var name = option.shopname
      if (option.shopname == '切换店铺'){
        name = '无'
      }
      $.httpPost("shop_select", { rd_session: rd_session}, (data, err) => {
        this.setData({
          shoplist:data.data.list,
          shopname: name
        })
      })
    }
    
    
  },
  toindex(e){
    let id = e.currentTarget.dataset.id
    let district = e.currentTarget.dataset.district
    wx.setStorageSync('shop_id', id);
    wx.reLaunch({
      url: '/pages/index/index?district=' + district,
    })
  }
  
});